<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:pe="http://primefaces.org/ui/extensions"
                xmlns:f="http://java.sun.com/jsf/core">

    <ui:define name="content">
        <h:panelGroup>

            <h:form id="form1">
                <p:panel header="All Bills">
                    <p:panel styleClass="noBorder summeryBorder">
                        <f:facet name="header" >
                            <p:outputLabel value="Duplicate Bill Numbers" />
                        </f:facet>
                        <h:panelGrid columns="2" >
                            <p:outputLabel value="From Date" />
                            <p:calendar value="#{dataAdministrationController.fromDate}" styleClass="dateTimePicker" pattern="yyyy MM dd hh:mm:ss a" />
                            <p:outputLabel value="To Date" />
                            <p:calendar value="#{dataAdministrationController.toDate}" styleClass="dateTimePicker" pattern="yyyy MM dd hh:mm:ss a" />
                            <p:outputLabel value="Bill Type" />
                            <p:selectOneMenu value="#{dataAdministrationController.reportKeyWord.billType}" >
                                <f:selectItem itemLabel="Select Bill Type" />
                                <f:selectItems value="#{enumController.billTypes}" var="t" itemLabel="#{t}" itemValue="#{t}" />
                            </p:selectOneMenu>
                            <p:commandButton value="Process" action="#{dataAdministrationController.createDuplicateBillTableByBillType}" ajax="false" />
                            <p:commandButton value="Process All" action="#{dataAdministrationController.createBillTable}" ajax="false" />
                            <p:commandButton value="Excel" ajax="false">
                                <pe:exporter type="xlsx" target="dtable" fileName="opd_search_professional_payment_done"  />
                            </p:commandButton>
                        </h:panelGrid>
                        <p:dataTable id ="dtable" value="#{dataAdministrationController.bills}" var="b" rowIndexVar="a" >
                            <p:column>
                                <f:facet name="header">
                                    <p:outputLabel value="No" />
                                </f:facet>
                                <p:outputLabel value="#{a+1}" />
                            </p:column>
                            <p:column rendered="#{dataAdministrationController.reportKeyWord.billType eq null}">
                                <f:facet name="header">
                                    <p:outputLabel value="Bill Type" />
                                </f:facet>
                                <p:outputLabel value="#{b.billType}" />
                            </p:column>
                            <p:column sortBy="#{b.id}">
                                <f:facet name="header">
                                    <p:outputLabel value="ID" />
                                </f:facet>
                                <p:outputLabel value="#{b.id}" />
                            </p:column>
                            <p:column sortBy="#{b.insId}">
                                <f:facet name="header">
                                    <p:outputLabel value="Bill Id" />
                                </f:facet>
                                <p:outputLabel value="#{b.insId}" />
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <p:outputLabel value="Bill Id" />
                                </f:facet>
                                <p:outputLabel value="#{b.deptId}" />
                            </p:column>
                            <p:column sortBy="#{b.insId}">
                                <f:facet name="header">
                                    <p:outputLabel value="Billed Id" />
                                </f:facet>
                                <p:outputLabel value="#{b.billedBill.insId}" />
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <p:outputLabel value="Billed Id" />
                                </f:facet>
                                <p:outputLabel value="#{b.billedBill.deptId}" />
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <p:outputLabel value="payment Methord" />
                                </f:facet>
                                <p:outputLabel value="#{b.paymentMethod}" />
                            </p:column>
                            <p:column sortBy="#{b.creater.webUserPerson.name}">
                                <f:facet name="header">
                                    <p:outputLabel value="Date" />
                                </f:facet>
                                <p:outputLabel value="#{b.creater.webUserPerson.name}" />
                            </p:column>
                            <p:column sortBy="#{b.createdAt}">
                                <f:facet name="header">
                                    <p:outputLabel value="Date" />
                                </f:facet>
                                <p:outputLabel value="#{b.createdAt}" >
                                    <f:convertDateTime pattern="yyyy MM dd hh:mm:ss:SSS a" />
                                </p:outputLabel>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <p:outputLabel value="Total" />
                                </f:facet>
                                <p:outputLabel value="#{b.netTotal+b.vat}" style="float: right;">
                                    <f:convertNumber pattern="#,##0.00" />
                                </p:outputLabel>
                            </p:column>
                        </p:dataTable>
                    </p:panel>


                </p:panel>
            </h:form>
        </h:panelGroup>
    </ui:define>

</ui:composition>
